package model;

import java.util.Random;
import java.util.UUID;

public class Order {
   int  order_id ;
   int user_id ;
    String recipient_name ;//收件人
    String recipient_address ;//'收件地址',
   String  recipient_phone ;// '收件电话',

    public void setRecipient_phone(String recipient_phone) {
        this.recipient_phone = recipient_phone;
    }

    String  notes; // '订单备注',
  String   order_date;// '订单创建时间',
    Double order_total;
    String order_status;// 订单状态('pending', 'processing', 'shipped', 'delivered', 'cancelled') 未下单、已下单、已发货、收货

    public void setOrder_total(Double order_total) {
        this.order_total = order_total;
    }
    public Order(){}

    public int generateOrderID() {
        String uuid = UUID.randomUUID().toString().replaceAll("-", "");
        String randomDigits = uuid.replaceAll("[^0-9]", "");

        // 确保随机数字至少有8位
        while (randomDigits.length() < 8) {
            randomDigits += (int) (Math.random() * 10); // 生成额外的随机数字以填充不足的部分
        }

        // 截取前8位数字
        String orderIDString = randomDigits.substring(0, 8);
        this.order_id = Integer.parseInt(orderIDString);

        return order_id;
    }

    public Order(int order_id, int user_id, String recipient_name, String recipient_address, String recipient_phone, String notes,  String order_status, String order_date, Double order_total

    ) {
        this.order_id = order_id;
        this.user_id = user_id;
        this.recipient_name = recipient_name;
        this.recipient_address = recipient_address;
        this.recipient_phone = recipient_phone;
        this.notes = notes;
        this.order_status = order_status;
        this.order_date = order_date;
        this.order_total = order_total;
    }

    public int getOrder_id() {
        return order_id;
    }

    public void setOrder_id(int order_id) {
        this.order_id = order_id;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public String getRecipient_name() {
        return recipient_name;
    }

    public void setRecipient_name(String recipient_name) {
        this.recipient_name = recipient_name;
    }

    public String getRecipient_address() {
        return recipient_address;
    }

    public String getRecipient_phone() {
        return recipient_phone;
    }

    public void setRecipient_address(String recipient_address) {
        this.recipient_address = recipient_address;
    }


    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getOrder_date() {
        return order_date;
    }

    public void setOrder_date(String order_date) {
        this.order_date = order_date;
    }

    public String getOrder_status() {
        return order_status;
    }

    public void setOrder_status(String order_status) {
        this.order_status = order_status;
    }

    public double getOrder_total() {
        return order_total;
    }

    public void setOrder_total(double order_total) {
        this.order_total = order_total;
    }




}

